<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>const知识点</title>
    </head>
    <body>

    </body>
    <script>
        "use strict"
        //es6之前声明常量的方式
        /*
        var a = 1;
        function fn(){
            a = 2;
            console.log(a);
        }

        fn();
        console.log(a);
        */
       //es6改写代码
       const a = 1;
       function fn(){
            a = 2;
            console.log(a);
       }
       fn();
       console.log(a);

    </script>
</html>